package com.mirei.listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;


/**
 * @author lazy队列监听与创建
 */
@Slf4j
@Component
public class LazyListener {
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "boot.lazy", durable = "true", arguments = @Argument(name = "x-queue-mode", value = "lazy")),
            exchange = @Exchange(name = "boot.lazy", type = ExchangeTypes.TOPIC),
            key = {"red", "blue"}))
    public void listenLazyQueue(String msg) {
        log.info("消费者收到[boot.lazy]队列的消息,内容:{}", msg);
    }
}
